Skip to main content
POST
/
api
/
v3
/
checkout
/
sessions
Create a checkout session [V3]
curl --request POST \
  --url https://api.loops.fi/api/v3/checkout/sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "line_items": [
    {
      "price": "<string>",
      "quantity": 1,
      "adjustable_quantity": {
        "enabled": false,
        "minimum": 2,
        "maximum": 2
      }
    }
  ],
  "mode": "payment",
  "success_url": "<string>",
  "cancel_url": "<string>",
  "payment_method_types": [
    "card"
  ],
  "customer": "<string>",
  "customer_email": "jsmith@example.com",
  "client_reference_id": "<string>",
  "metadata": {},
  "productId": "<string>",
  "quantity": 1,
  "externalCustomerId": "<string>"
}'
{
  "id": "<string>",
  "object": "checkout.session",
  "amount_subtotal": 123,
  "amount_total": 123,
  "automatic_tax": {
    "enabled": true,
    "status": "complete"
  },
  "billing_address_collection": "auto",
  "cancel_url": "<string>",
  "client_reference_id": "<string>",
  "currency": "<string>",
  "customer": "<string>",
  "customer_email": "jsmith@example.com",
  "expires_at": 123,
  "livemode": true,
  "locale": "<string>",
  "metadata": {},
  "mode": "payment",
  "payment_intent": "<string>",
  "payment_method_types": [
    "<string>"
  ],
  "payment_status": "paid",
  "setup_intent": "<string>",
  "shipping": {
    "address": {
      "city": "<string>",
      "country": "<string>",
      "line1": "<string>",
      "line2": "<string>",
      "postal_code": "<string>",
      "state": "<string>"
    },
    "name": "<string>",
    "phone": "<string>"
  },
  "submit_type": "auto",
  "success_url": "<string>",
  "total_details": {
    "amount_discount": 123,
    "amount_shipping": 123,
    "amount_tax": 123
  },
  "url": "<string>",
  "productName": "<string>",
  "externalCustomerId": "<string>"
}

Authorizations

Authorization
string
header
required

API Key authentication using Bearer token

Body

application/json
  • Option 1
  • Option 2
line_items
object[]
required
mode
enum<string>
default:payment

The mode of the Checkout Session

Available options:
payment,
subscription,
setup
success_url
string<uri>

The URL to redirect your customer back to after they authenticate or cancel their payment

cancel_url
string<uri>

The URL to redirect your customer back to after they authenticate or cancel their payment

payment_method_types
enum<string>[]

The types of payment methods this Checkout Session can accept

customer
string

ID of an existing customer

customer_email
string<email>

Email of the customer

client_reference_id
string

A unique string to reference the Checkout Session

metadata
object

Set of key-value pairs that you can attach to an object

productId
string

Loops product ID (alternative to line_items for simplified usage)

quantity
integer
default:1

Quantity when using productId (Loops-specific)

Required range: 1 <= x <= 1000
externalCustomerId
string

External customer identifier (Loops-specific)

Response

Default Response

id
string
required

Unique identifier for the object

object
enum<string>
required

String representing the object's type

Available options:
checkout.session
amount_subtotal
integer
required

Total of all items before discounts or taxes

amount_total
integer
required

Total of all items after discounts and taxes

cancel_url
string<uri>
required

The URL the customer will be directed to if they decide to cancel payment

currency
string
required

Three-letter ISO currency code

livemode
boolean
required

Has the value true if the object exists in live mode or the value false if the object exists in test mode

mode
enum<string>
required

The mode of the Checkout Session

Available options:
payment,
subscription,
setup
payment_status
enum<string>
required

Payment status

Available options:
paid,
unpaid,
no_payment_required
success_url
string<uri>
required

The URL the customer will be directed to after the payment or subscription creation is successful

url
string<uri>
required

The URL to the Checkout Session

automatic_tax
object
billing_address_collection
enum<string>
Available options:
auto,
required
client_reference_id
string

A unique string to reference the Checkout Session

customer
string

ID of the customer

customer_email
string<email>

Email of the customer

expires_at
integer

Unix timestamp representing the time at which the Checkout Session expires

locale
string

The IETF language tag of the locale

metadata
object

Set of key-value pairs that you can attach to an object

payment_intent
string

ID of the PaymentIntent

payment_method_types
string[]

The list of payment method types (e.g. card) that this Checkout Session is allowed to accept

setup_intent
string

ID of the SetupIntent

shipping
object
submit_type
enum<string>

Describes the type of transaction being performed

Available options:
auto,
book,
donate,
pay
total_details
object
productName
string

Name of the product (Loops-specific)

externalCustomerId
string

External customer identifier (Loops-specific)

I